export function connectDevTools(address?: string) {
  const script = document.createElement("script");
  script.src = address || "http://localhost:8098";
  document.head.appendChild(script);
}

export function exposeGlobalIfDev(name: string, value: any) {
  if (import.meta.env.DEV) {
    (window as any)[name] = value;
  }
}

export function exposeGlobal(name: string, value: any) {
  (window as any)[name] = value;
}

export function deleteGlobal(name: string) {
  delete (window as any)[name];
  if ((window as any)[name] != null) {
    exposeGlobal(name, undefined);
  }
}
